<?php
include("admin_check.php");
include_once("../class/ulevel_class.php");
include_once("../class/system_class.php");
session_start();
header("Content-Type: text/html;charset=utf-8");
checkqx(6,30);
$_system=new system_class();
$sys=$_system->system_information(1);
if($_POST['button']){
    $ulevel=new ulevel_class();
    $lvid="lvid";
    $lvname="name";
    $lsk="lsk";
    $yl1="yl1";
    $yl2="yl2";
    $yl3="yl3";
    $yl4="yl4";
    $yl5="yl5";
    $yl6="yl6";
    $yl7="yl7";
    $yl8="yl8";
    $yl9="yl9";
    $yl10="yl10";
    $yl11="yl11";
    $yl12="yl12";
    $yl13="yl13";
    $yl14="yl14";
    $yl15="yl15";
    $yl16="yl16";
    $yl17="yl17";
    $yl18="yl18";
    $yl19="yl19";
    $yl20="yl20";
    $yl21="yl21";
    $yl22="yl22";
    $yl23="yl23";
    $yl24="yl24";
    $yl25="yl25";
    $yl26="yl26";


    for($i=1;$i<=$ulevel->Getulevelcount();$i++){
        $up_ulevel=NULL;
        $up_ulevel['id']=$_POST[$lvid.$i];
        $up_ulevel['lvname']=$_POST[$lvname.$i];
        $up_ulevel['lsk']=$_POST[$lsk.$i];
        $up_ulevel['yl1']=$_POST[$yl1.$i];
        $up_ulevel['yl2']=$_POST[$yl2.$i];
        $up_ulevel['yl3']=$_POST[$yl3.$i];
        $up_ulevel['yl4']=$_POST[$yl4.$i];
        $up_ulevel['yl5']=$_POST[$yl5.$i];
        $up_ulevel['yl6']=$_POST[$yl6.$i];
        $up_ulevel['yl7']=$_POST[$yl7.$i];
        $up_ulevel['yl8']=$_POST[$yl8.$i];
        $up_ulevel['yl9']=$_POST[$yl9.$i];
        $up_ulevel['yl10']=$_POST[$yl10.$i];
        $up_ulevel['yl11']=$_POST[$yl11.$i];
        $up_ulevel['yl12']=$_POST[$yl12.$i];
        $up_ulevel['yl13']=$_POST[$yl13.$i];
        $up_ulevel['yl14']=$_POST[$yl14.$i];
        $up_ulevel['yl15']=$_POST[$yl15.$i];
        $up_ulevel['yl16']=$_POST[$yl16.$i];
        $up_ulevel['yl17']=$_POST[$yl17.$i];
        $up_ulevel['yl18']=$_POST[$yl18.$i];
        $up_ulevel['yl19']=$_POST[$yl19.$i];
        $up_ulevel['yl20']=$_POST[$yl20.$i];
        $up_ulevel['yl21']=$_POST[$yl21.$i];
        $up_ulevel['yl22']=$_POST[$yl22.$i];
        $up_ulevel['yl23']=$_POST[$yl23.$i];
        $up_ulevel['yl24']=$_POST[$yl24.$i];
        $up_ulevel['yl25']=$_POST[$yl25.$i];
        $up_ulevel['yl26']=$_POST[$yl26.$i];
        $ulevel->ulevel_update($up_ulevel);
    }

    alert('保存成功.','?');
}
if($_POST['button2']){
    $ulevel=new ulevel_class();
    $yl14="yl14";
    $yl15="yl15";
    $yl16="yl16";
    $yl17="yl17";
    $yl18="yl18";
    $yl19="yl19";
    $yl20="yl20";
    $yl21="yl21";
    $yl22="yl22";

        $up_ulevel=NULL;
        $up_ulevel['id']=1;
        $up_ulevel['yl14']=$_POST[$yl14];
        $up_ulevel['yl15']=$_POST[$yl15];
        $up_ulevel['yl16']=$_POST[$yl16];
        $up_ulevel['yl17']=$_POST[$yl17];
        $up_ulevel['yl18']=$_POST[$yl18];
        $up_ulevel['yl19']=$_POST[$yl19];
        $up_ulevel['yl20']=$_POST[$yl20];
        $up_ulevel['yl21']=$_POST[$yl21];
        $up_ulevel['yl22']=$_POST[$yl22];
        $ulevel->ulevel_update($up_ulevel);

    alert('保存成功.','?');
}

?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="css/table.css" rel="stylesheet" type="text/css">
    <link href="css/style.css" rel="stylesheet" type="text/css">
    <link href="../layui-master/dist/css/layui.css" rel="stylesheet" type="text/css">
    <script src="../layui-master/dist/layui.js"></script>
    <title>级别参数</title>
</head>
<body>
<form name="form1" method="post" action="?">
    <table width="100%" cellpadding="3" cellspacing="1" border="0" align="center" class="layui-table" lay-skin="line">
        <tr>
            <td height="10" colspan="30" align="center">级别参数</td>
        </tr>
        <tr>
            <td align="center">级别</td>
            <td align="center">名称</td>
            <td align="center">投资金额</td>
            <td align="center">直推奖</td>
            <td align="center">层碰奖</td>
            <td align="center">见点奖</td>
            <td align="center">见点层数</td>
            <td align="center">报单奖</td>
        </tr>
        <?php
        $sql = "SELECT * FROM `ulevel` order by ulevel";
        if($query = mysql_query($sql)){
            $i=1;
            while ($row=mysql_fetch_array($query)){
                ?>
                <tr>
                    <td align="center"><input name="lvid<?=$i?>" type="hidden" value="<?=$row['id']?>"><?=$row['ulevel']?></td>
                    <td align="center"><input name="name<?=$i?>" type="text" value="<?=$row['lvname']?>" size="6"maxlength="10"></td>
                    <td align="center"><input name="lsk<?=$i?>" type="text" value="<?=$row['lsk']?>" size="4"maxlength="10"></td>
                    <td align="center"><input name="yl1<?=$i?>" type="text" value="<?=$row['yl1']?>" size="5" maxlength="10"></td>
                    <td align="center"><input name="yl2<?=$i?>" type="text" value="<?=$row['yl2']?>" size="7" maxlength="10"></td>
                    <td align="center"><input name="yl3<?=$i?>" type="text" value="<?=$row['yl3']?>" size="4" maxlength="10"></td>
                    <td align="center"><input name="yl4<?=$i?>" type="text" value="<?=$row['yl4']?>" size="4" maxlength="10"></td>
                    <td align="center"><input name="yl5<?=$i?>" type="text" value="<?=$row['yl5']?>" size="4" maxlength="10"></td>
                </tr>

                <?php
                $i++;
            }
        }
        ?>
        <tr>
            <td width="58%" height="10" colspan="30" align="center"><input name="button" type="submit" class="layui-btn layui-btn-warm" id="button" value="保存"></td>
        </tr>
    </table>


</form>

</body>
</html>